{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-header">
        <div class="layui-btn-group">
            <a href="{:url('lnadmin/store/add_taocan')}" class="layui-btn ajax-iframe" data-width="600px" data-height="510px">新增套餐</a>
        </div>
    </div>
    
    <table id="tableList" lay-filter="tableList"></table>
    <!-- 表格操作列 -->
    <script type="text/html" id="tableTBTrack">
        <a href="{:url('lnadmin/store/edit_taocan')}?id={{d.id}}" class="layui-btn layui-btn-sm ajax-iframe" data-width="600px" data-height="510px">修改</a>
        <a href="{:url('lnadmin/store/del_taocan')}?id={{d.id}}" class="layui-btn layui-btn-danger layui-btn-sm ajax-delete">删除</a>
    </script>
    <!-- 权限列 -->
    <script type="text/html" id="status">
        <input type="checkbox" name="status" lay-skin="switch" lay-filter="*" lay-text="正常|锁定" data-url="{:url('lnadmin/store/edit_taocan')}?id={{d.id}}" {{d.status==1?'checked':''}}>
    </script>

</div>
{/block}

{block name="js"}
<script>
    layui.use(['layer', 'form', 'table', 'util', 'dropdown'], function () {
        var table = layui.table;

        // 渲染回访表格
        var insTb = table.render({
            elem: '#tableList',
            url: "{:url('lnadmin/store/taocan_json')}",
            page: true,
            cellMinWidth: 100,
            limit:'15',
            limits:[15,30,50,100,200,500],
            size:'sm',even:true,
            cols: [[
                {type:'numbers',title:'#'},
                {field: 'name', align: 'left', sort: true, title: '套餐名称'},
                {field: 'description', align: 'left', sort: true, title: '套餐介绍'},
                {align: 'center', sort: true, title: '状态',templet:'#status',width:100},
                {align: 'center', toolbar: '#tableTBTrack', title: '操作', minWidth: 190}
            ]],
            parseData: function(res){ //res 即为原始返回的数据
                return {
                  "code": res.code, //解析接口状态
                  "msg": res.msg, //解析提示文本
                  "count": res.data.total, //解析数据长度
                  "data": res.data.data //解析数据列表
                };
            }
        });

    });

</script>
{/block}